window.onload = function () {
    var btn_stusubmit = document.getElementById('btn_stusubmit');
    var btn_teasubmit = document.getElementById('btn_teasubmit');

    btn_stusubmit.onclick = function submits() {
        alert("11")


        //alert($("#formstu").serialize());
        $.ajax({
            url:"http://localhost:8080/addUser",
            type:"GET",
            data:$("#formstu").serialize(),//serialize()能将表单封装进行传递
            dataType:"json",
            success:function(rs){
                if (rs.ok){
                   alert(rs.respMsg)
                    //2.跳转后台页面
                    window.location.href="login.html";
                } else{
                    alert(rs.respMsg);
                }
            },
            error:function (rs) {
            }
        });

    }
    btn_teasubmit.onclick = function submits() {
        alert("11")


        //alert($("#formstu").serialize());
        $.ajax({
            url:"http://localhost:8080/addUser",
            type:"GET",
            data:$("#formtea").serialize(),//serialize()能将表单封装进行传递
            dataType:"json",
            success:function(rs){
                if (rs.ok){
                   alert(rs.respMsg)
                    //2.跳转后台页面
                    window.location.href="login.html";
                } else{
                    alert(rs.respMsg);
                }
            },
            error:function (rs) {
            }
        });

    }

}
function viewtea() {
    document.getElementById("teacher").style.display="block";
    document.getElementById("student").style.display="none";
}
function viewstu() {
    document.getElementById("student").style.display="block";
    document.getElementById("teacher").style.display="none";
}
